<template>
    <div id="parts">
        <el-table :data="listdata.slice((currentPage-1)*pagesize,currentPage*pagesize)" stripe border :height="tableHeight" :header-cell-style="getRowClass">
            <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
            <el-table-column prop="dealerName" label="经销商名称" sortable min-width="280"></el-table-column>
            <el-table-column prop="productName" label="产品名称" sortable min-width="220"></el-table-column>
            <el-table-column prop="orderNum" label="订单号" sortable min-width="160"></el-table-column>
            <el-table-column prop="type" label="类型" sortable min-width="130"></el-table-column>
            <el-table-column prop="typeNum" label="型号" sortable min-width="140"></el-table-column>
            <el-table-column prop="unitName" label="单位" sortable min-width="100"></el-table-column>
            <el-table-column prop="instorageNum" label="入库数量" sortable min-width="110"></el-table-column>
            <el-table-column prop="orderTime" label="下单时间" sortable min-width="170"></el-table-column>
            <el-table-column prop="instorageTime" label="入库时间" sortable min-width="170"></el-table-column>
        </el-table>
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10, 15,20, 25,30,50, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="listdata.length"></el-pagination>

    </div>
</template>

<script>
    export default {
        data() {
            let token = sessionStorage.getItem("tokenId");
            return {
                tokenId: token,
                currentPage: 1,
                pagesize: 10,
                tableHeight: document.documentElement.clientHeight - 130,
                listdata:[],
            };
        },
        created() {
            this.getProduceData()
        },
        methods:{

            getProduceData() {
                let _this = this;
                this.$http({
                    url: '/api/adscm/stock/jyInStorage/selectAll?tokenId=' + _this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.listdata = res.data.content;
                        console.log(_this.listdata)
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            handleSizeChange: function (size) {
                this.pagesize = size;
            },
            handleCurrentChange: function (currentPage) {
                this.currentPage = currentPage;
            },


        }

    };
</script>

<style  scoped>


</style>
